﻿using OpenQA.Selenium;

namespace SimulationCenter.Scripts
{
    /// <summary>
    /// 微信版本 6.7.3
    /// </summary>
    public class Const
    {
        public static string RemoteServer = "http://127.0.0.1:4723/wd/hub";

        public const string AppPackage = "com.tencent.mm";

        public const string LauncherUi = "ui.LauncherUI";

        public static readonly By FlashPageXpath =
            By.XPath("/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.FrameLayout/android.widget.ImageView");

        /// <summary>
        /// 通讯录
        /// </summary>
        public static readonly By TabContactsId = By.Id($"{AppPackage}:id/po");

        /// <summary>
        /// 公众号
        /// </summary>
        public static readonly By SubscriptionMenuId = By.Id($"{AppPackage}:id/a2n");

        /// <summary>
        /// 公众号列表页
        /// </summary>
        public const string SubscriptionsActivity = ".plugin.brandservice.ui.BrandServiceIndexUI";

        /// <summary>
        /// 公众号聊天页面
        /// </summary>
        public const string SubscriptionChattingActivity = ".ui.chatting.ChattingUI";

        /// <summary>
        /// 公众号 ListView
        /// </summary>
        public static readonly By SubscriptionsId = By.Id($"{AppPackage}:id/a01");

        /// <summary>
        /// 公众号  ListView Item
        /// </summary>
        public static readonly string SubscriptionId = $"{AppPackage}:id/a6b";

        /// <summary>
        /// 公众号标题
        /// </summary>
        public static readonly By SubscriptionTitleId = By.Id($"{AppPackage}:id/a6e");

        public static readonly string SubscriptionTitle = "new UiSelector().text(\"{0}\")";

        /// <summary>
        /// 公众号
        /// </summary>
        public static string SubscriptionsLocator =
            $"new UiScrollable(new UiSelector()).scrollIntoView(new UiSelector().resourceId(\"{SubscriptionId}\"));";

        /// <summary>
        /// 公众号 ListView 底部
        /// </summary>
        public static readonly By SubscriptionsBottomId = By.Id($"{AppPackage}:id/azu");

        /// <summary>
        /// 公众号详情
        /// </summary>
        public static readonly By SubscriptionProfileId = By.Id($"{AppPackage}:id/j1");

        /// <summary>
        /// 公众号详情页面的公众号标题
        /// </summary>
        public static readonly By SubscriptionProfileTitle = By.Id($"{AppPackage}:id/awq");

        /// <summary>
        /// 公众号详情右上角菜单
        /// </summary>
        public static readonly By SubscriptionInfoMenuId = By.Id($"{AppPackage}:id/j1");

        /// <summary>
        /// 公众号更多资料页面
        /// </summary>
        public const string SubscriptionMoreInfoPage = ".plugin.profile.ui.newbizinfo.NewBizInfoMoreInofUI";

        /// <summary>
        /// 公众号更多资料每一项
        /// </summary>
        public static readonly By SubscriptionMoreInfos = By.Id($"{AppPackage}:id/lr");

        /// <summary>
        /// 公众号详情底部
        /// </summary>
        public static readonly By LoadAllMessagesId = By.Id($"{AppPackage}:id/avt");

        /// <summary>
        /// 公众号WebView页面
        /// </summary>
        public const string SubscriptionWebViewPage = ".plugin.webview.ui.tools.WebviewMpUI";

        /// <summary>
        /// 公众号 WebView 页面返回按钮
        /// </summary>
        public static readonly By SubscriptionWebViewBackId = By.Id($"{AppPackage}:id/jc");

        /// <summary>
        /// 公众号 聊天页面返回按钮
        /// </summary>
        public static readonly By SubscriptionChattingBackId = By.Id($"{AppPackage}:id/j5");


        /// <summary>
        /// 首页搜索按钮
        /// </summary>
        public static readonly By SearchButtonXpath = By.XPath("//android.widget.TextView[@content-desc=\"搜索\"]");

        /// <summary>
        /// 搜索输入框
        /// </summary>
        public static readonly By SearchTextBoxId = By.Id($"{AppPackage}:id/ji");

        /// <summary>
        /// 搜一搜
        /// </summary>
        public static readonly By SearchSubscriptionsId = By.Id($"{AppPackage}:id/bq0");

        /// <summary>
        /// 搜索结果 WebView
        /// </summary>
        public static readonly string SearchSubscriptionWebViewPage = ".plugin.webview.ui.tools.fts.FTSSOSHomeWebViewUI";

        /// <summary>
        /// 公众号简介页
        /// </summary>
        public static readonly string SubscriptionInfoPage = ".plugin.profile.ui.ContactInfoUI";
    }
}
